//
//  MinChart.h
//  Stock_Pro
//
//  Created by imuse on 10-11-21.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "QuoteLvData.h"

#import "Gui_Rect.h"

#import "QuoteLvMinIndex.h"
#import "HZBaseMarketView.h"

#define MIN_PRICE_SCALES_NUM	5
#define MIN_VOLUME_SCALES_NUM	3

enum MIN_SHOW_MODE_tag {
	MIN_SHOW_MODE_NORMAL,        //常太图,价格＋量或指标
	MIN_SHOW_MODE_MINI,          //迷你小图
	MIN_SHOW_MODE_EXPAND_INDEX,	//三栏图，价格＋量＋指标
};

enum MIN_SHOW_INDEX_tag {
  MIN_SHOW_INDEX_VOLUME,            //成交量
  MIN_SHOW_INDEX_BUY_SELL_STRENGTH, //买卖力道
  MIN_SHOW_INDEX_LEVE2_DDX,         //大单动向
  MIN_SHOW_INDEX_LEVE2_FUND_FLOW,   //资金流向
  MIN_SHOW_INDEX_LEVE2_BBD,         //大单净额差累积值
};


@interface MinChart : HZBaseMarketView {
	QUOTELV_MIN_RES *pMinRes;	//分时数据结构
  QUOTELV_MIN_INDEX *pMinIndex;
  
	GUI_POINT *pLineCur;	//价线
	GUI_POINT *pLineAvg;	//均价线
	GUI_POINT *pLineVol;	//成交量线
	
	//okex红绿柱
	GUI_POINT *pRdpUp;		//红绿柱上涨	－－｜－这样分开两个是为了绘图时减少判断，提高绘图效率
	GUI_POINT *pRdpDown;	//红绿柱下跌	－－｜
	int nRdpUp;				//红柱数量
	int nRdpDown;			//绿柱数量
	
	float fScalesPrice[MIN_PRICE_SCALES_NUM];			//价刻度
	long64 lScalesVolume[MIN_VOLUME_SCALES_NUM];	//量刻度
	long64 lScalesBS[MIN_VOLUME_SCALES_NUM];	//买卖力道
	float fScalesRange[MIN_PRICE_SCALES_NUM];			//幅度刻度
  
	
	
	int nMaxPosCount;		//最大点个数
	int nPos;           //十字线位置
	BOOL bMul;          //是否有十字线
  BOOL isSeparatePriceLineAndVol;     //价格线和量线是否分开
	
	//信息地雷
	QUOTELV_STOCKINFO_RES *pMinInfoRes;		//信息地雷数据
	GUI_POINT *pMine;						//信息地雷点位置
	int nMineCount;							//信息地雷个数
	
	//市场信息
	QUOTELV_TRADING_HOURS_ITEM *pItem;		
	
	//显示方式
	int nMode;
  
  //okex类型
  int nExpandIndex;
	
	//买卖力道
	GUI_POINT *pLineVolBuy;		//买卖力道买线
	GUI_POINT *pLineVolSell;	//买卖力道卖线
	GUI_POINT *pVolBSBuy;			//买卖力道买多线	－－｜－这样分开两个是为了绘图时减少判断，提高绘图效率
	GUI_POINT *pVolBSSell;		//买卖力道卖多线	－－｜
	int nVolBuy;				//买多线个数
	int nVolSell;				//卖多线个数
	int nBS0Y;					//买卖力道0轴
	
	int nPriceTop;              //价y坐标
	int nVolTop;                //量y坐标
	int nVolExpandIndexTop;     //买卖力道y坐标
	int nPriceHeight;           //价高
	int nVolHeight;             //量高
	int nVolExpandIndexHeight;	//买卖力道高
	int nItemHeight;	//等分后每份高度
  int nMineTop;     //信息地雷顶
  
  //ddx
  GUI_POINT *pDDX1;
//  GUI_POINT *pDDX2;
//  GUI_POINT *pDDX3;
  int nDDX_Y_0;//ddx 0轴位置
  int nDDX_DDUpLen;
	int nDDX_DDDownLen;
  GUI_RECT *pLineDDXUp;
	GUI_RECT *pLineDDXDown;
  float fScalesDDX[MIN_VOLUME_SCALES_NUM];
  
  GUI_POINT *pFundFlow1;
  GUI_POINT *pFundFlow2;
  GUI_POINT *pFundFlow3;
  GUI_POINT *pFundFlow4;
  float fScalesFundFlow[MIN_VOLUME_SCALES_NUM];
  
  GUI_POINT *pBBD1;
  float fScalesBBD[MIN_VOLUME_SCALES_NUM];
  //
	//主题相关
	int bgColor;
	int priceColor;
	int avgColor;
	int volColor;
	int tenLineColor;
	int nVolScaleColor;
	int redColor;
	int greenColor;
	int equalColor;
	//MINI(渐变颜色)
	int	bezierColor;
	int pathColor;
  //边框颜色
  int  frameColor;
  int  scalesLineColor;
	//end
	
	//
	UIImageView *mLeftView;
	UIImageView *mRightView;
	UIImageView *mBottomView;
	UILabel			*mLeft;
	UILabel			*mRight;
	UILabel			*mBottom;
	float				ty;
	float				pMax;
	float				pMin;
	//
  UILabel     *mVol;
  UILabel     *mVolValue;
  UILabel     *mHand;
  UILabel     *mHandValue;
  UIButton    *mVerButton;//换横屏按钮
	
	id			parentController;
  
  
  //lisz
  //分钟点x坐标
  float *m_pf_point_x;
  //lisz
    
    BOOL                isLandscape;           //是否横屏
    int                 nLastPosX;             //上一个触摸点X坐标
    BOOL                isMoved;               //是否触摸移动
  
    float               fPointR;//最新点的外圆半径
    ///分时最新一点的定时器
    NSTimer                 *pTimer;
    ///计数
    int                     nIndex;
    UIButton  *pLandScapeBtn;
}
@property (nonatomic, assign)BOOL                   isLandscape;

- (id)initWithFrame:(CGRect)frame withParent:(id)parent;

-(void)setData:(QUOTELV_MIN_RES*)p withTradingHours:(QUOTELV_TRADING_HOURS*)pTradingHours;
-(QUOTELV_TRADING_HOURS_ITEM*)getTradingHours;
-(void)setPos:(int)n;
-(int)getPos;
-(void)setMul:(BOOL)b;
-(BOOL)getMulShow;

-(void)setMineData:(QUOTELV_STOCKINFO_RES*)p;
-(QUOTELV_STOCKINFO_RES*)getMineData;

-(void)calcData;
-(void)calcMineData;

-(void)clear;

-(void)setMode:(int)n;//设置分时显示模式
-(void)setVolData:(NSArray*)aData;
///切换显示指标
-(void)setCurShowIndex:(int)n;
//切换颜色
-(void)setColors:(NSArray*)aArray;
//MINI
-(void)setMINIColor:(NSArray*)aArray;
//获得涨跌颜色
-(int)getMinColor:(float)a with:(float)b;
//计算时间
-(NSString*)clacTime;
-(void)OnChangeTheme:(int)nThemeId withPath:(NSString*)path;

- (void)startTime;
- (void)setLandScapeBtnHidden:(BOOL)hidden;

- (void)updateNewData;
@end
